package utils;

import com.alibaba.fastjson.JSONObject;

import java.util.List;

public class Laytab {
    public Laytab(List data, Long count) {
        this.data = data;
        this.count = count;
        this.code = 0;
        this.msg = "";
    }

    public Laytab(List data, Long count, String msg) {
        this.data = data;
        this.count = count;
        this.msg = msg;
        this.code = 0;
    }

    public Laytab(List data, Long count, String msg, int code) {
        this.data = data;
        this.count = count;
        this.code = code;
        this.msg = msg;
    }

    //数据主体
    private List data;
    //总行数统计
    private Long count;
    //状态码
    private int code;
    //信息
    private String msg;

    public JSONObject toJSON(){
        JSONObject json = new JSONObject();
        json.put("data",this.data);
        json.put("count",this.count);
        json.put("code",this.code);
        json.put("msg",this.msg);
        return json;
    }
}
